<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="data:,">
    <title>智能教育系统</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <style>
        .navbar {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
            padding: 1rem 2rem;
            box-shadow: 0 2px 10px rgba(0,0,0,0.1);
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.3s ease;
        }

        .nav-container {
            max-width: 1200px;
            width: 100%;
            margin: 0 auto;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .nav-brand {
            color: white;
            font-size: 1.5rem;
            font-weight: bold;
            text-decoration: none;
            transition: all 0.3s ease;
            margin-right: 2rem;
            position: relative;
            overflow: hidden;
        }

        .nav-brand::after {
            content: '';
            position: absolute;
            bottom: -2px;
            left: 0;
            width: 100%;
            height: 2px;
            background: white;
            transform: translateX(-100%);
            transition: transform 0.3s ease;
        }

        .nav-brand:hover::after {
            transform: translateX(0);
        }

        .nav-brand:hover {
            transform: scale(1.05);
            text-shadow: 0 0 10px rgba(255,255,255,0.5);
        }

        .nav-links {
            display: flex;
            gap: 2rem;
            align-items: center;
            flex: 1;
            justify-content: flex-end;
        }

        .nav-link {
            color: white;
            text-decoration: none;
            font-weight: 500;
            padding: 0.5rem 1rem;
            border-radius: 20px;
            transition: all 0.3s ease;
            white-space: nowrap;
            position: relative;
            overflow: hidden;
        }

        .nav-link::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(255,255,255,0.1);
            transform: translateY(100%);
            transition: transform 0.3s ease;
            z-index: -1;
        }

        .nav-link:hover::before {
            transform: translateY(0);
        }

        .nav-link:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        .nav-link.active {
            background: rgba(255,255,255,0.3);
            box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-left: 2rem;
            position: relative;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255,255,255,0.2);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            transition: all 0.3s ease;
            cursor: pointer;
            position: relative;
            overflow: hidden;
        }

        .user-avatar::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
            transform: translateX(-100%);
            transition: transform 0.5s ease;
        }

        .user-avatar:hover::before {
            transform: translateX(100%);
        }

        .user-avatar:hover {
            transform: scale(1.1);
            box-shadow: 0 0 15px rgba(255,255,255,0.3);
        }

        @media (max-width: 768px) {
            .nav-links {
                display: none;
                position: absolute;
                top: 100%;
                left: 0;
                right: 0;
                background: #6e8efb;
                flex-direction: column;
                padding: 1rem;
                animation: slideDown 0.3s ease;
            }

            @keyframes slideDown {
                from {
                    opacity: 0;
                    transform: translateY(-10px);
                }
                to {
                    opacity: 1;
                    transform: translateY(0);
                }
            }

            .nav-links.active {
                display: flex;
            }

            .mobile-menu-btn {
                display: block;
                color: white;
                font-size: 1.5rem;
                cursor: pointer;
                transition: transform 0.3s ease;
            }

            .mobile-menu-btn:hover {
                transform: scale(1.1);
            }
        }
    </style>
</head>
<body>
    <nav class="navbar" th:fragment="navbar">
        <div class="nav-container">
            <a href="/" class="nav-brand">智能教育系统</a>
            <div class="nav-links">
                <a href="/" class="nav-link" th:classappend="${currentPage == 'home'} ? 'active'">首页</a>
                <a th:href="@{/exam/grade}" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">批改试卷</a>
                <a th:href="@{/exam/manage}" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">考试管理</a>
                <a th:href="@{/class/manage}" class="text-gray-300 hover:bg-gray-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">班级管理</a>
                <a href="/exam/history" class="nav-link" th:classappend="${currentPage == 'history'} ? 'active'">历史记录</a>
                <div class="user-info" th:if="${session.user != null}">
                    <div class="user-avatar" th:text="${session.user.username.substring(0,1).toUpperCase()}"></div>
                    <a href="/profile" class="nav-link">个人中心</a>
                    <a href="/simple-logout" class="nav-link">退出</a>
                </div>
                <div class="user-info" th:unless="${session.user != null}">
                    <a href="/simple-login" class="nav-link">登录</a>
                    <a href="/simple-register" class="nav-link">注册</a>
                </div>
            </div>
        </div>
    </nav>

    <script>
        // 添加页面滚动效果
        window.addEventListener('scroll', function() {
            const navbar = document.querySelector('.navbar');
            if (window.scrollY > 50) {
                navbar.style.background = 'rgba(110, 142, 251, 0.95)';
                navbar.style.padding = '0.8rem 2rem';
            } else {
                navbar.style.background = 'linear-gradient(135deg, #6e8efb, #a777e3)';
                navbar.style.padding = '1rem 2rem';
            }
        });

        // 移动端菜单切换
        const mobileMenuBtn = document.querySelector('.mobile-menu-btn');
        const navLinks = document.querySelector('.nav-links');
        if (mobileMenuBtn) {
            mobileMenuBtn.addEventListener('click', () => {
                navLinks.classList.toggle('active');
            });
        }

        // 添加导航链接点击波纹效果
        document.querySelectorAll('.nav-link').forEach(link => {
            link.addEventListener('click', function(e) {
                const ripple = document.createElement('div');
                ripple.classList.add('ripple');
                this.appendChild(ripple);
                
                const rect = this.getBoundingClientRect();
                const size = Math.max(rect.width, rect.height);
                
                ripple.style.width = ripple.style.height = `${size}px`;
                ripple.style.left = `${e.clientX - rect.left - size/2}px`;
                ripple.style.top = `${e.clientY - rect.top - size/2}px`;
                
                ripple.classList.add('active');
                
                setTimeout(() => {
                    ripple.remove();
                }, 600);
            });
        });
    </script>
</body>
</html> 